import time

from selenium import webdriver
from selenium.webdriver import Keys, ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver=webdriver.Edge()
driver.get('https://www.baidu.com/')
driver.maximize_window()
driver.refresh()
time.sleep(3)
search=driver.find_element(By.ID,'kw')
search.send_keys('web端自动化测试')
time.sleep(2)
driver.back()
time.sleep(2)
driver.forward()
time.sleep(2)
search.send_keys(Keys.ENTER)
time.sleep(5)
# # 双击
# ActionChains(driver).context_click(search).perform()
# time.sleep(2)
# # 三击
# # ActionChains(driver).double_click(search).click(search).perform()
# # 全选
# search.send_keys(Keys.CONTROL,'A')
# time.sleep(5)
# # 高级搜索
# search.send_keys(Keys.CONTROL,'c')
# time.sleep(2)
# s=driver.find_element(By.NAME,'tj_settingicon')
# ActionChains(driver).move_to_element(s).perform()
# time.sleep(5)
# driver.find_element(By.LINK_TEXT,"高级搜索").click()
# time.sleep(2)
# q3=driver.find_element(By.NAME,'q3')
# q3.send_keys(Keys.CONTROL,'v')
# time.sleep(2)
# ActionChains(driver).double_click(q3).perform()
# time.sleep(2)
# q3.send_keys(Keys.CONTROL,'x')
# time.sleep(2)
# q2=driver.find_element(By.NAME,'q2')
# q2.send_keys(Keys.CONTROL,'v')
# time.sleep(10)
#
# # 1月内
# driver.find_element(By.XPATH,'//*[@id="adv-setting-gpc"]/div/div[2]/div[2]/p[4]').click()
# time.sleep(2)
# # 网页格式
# driver.find_element(By.XPATH,'//*[@id="adv-setting-ft"]/div/div[2]/div[2]/p[3]').click()
# time.sleep(2)
# # 网站选择 百度
# driver.find_element(By.NAME,'q6').send_keys('百度')
# time.sleep(2)
# # 点击高级搜索
# driver.find_element(By.XPATH,'//*[@id="adv-setting-8"]/input[2]').click()
# time.sleep(2)
